package com.zx.mes.hyl.base.exception;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;

/**
 * exception 异常测试
 * @author 华云龙
 * @date 2018-9-30
 */
public class ExceptionTest {

    @Test
    public void test(){
        try {
            int i = 10 / 0;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
        }
    }

    @Test
    public void test2() throws FileNotFoundException {
        File file = new File("");
        file.getPath();
        FileReader fileReader = new FileReader(file);
    }

    @Test
    public void test3(){

        try {
            exception();
        } catch (ZeroException e) {
            e.printStackTrace();
        }

    }

    @Test
    public void test4(){
        try {
            int i = 10 / 0;
        } catch (ZeroException3 e) {
            e.printStackTrace();
        } finally {
        }
    }

    public void exception() throws ZeroException {

        throw new ZeroException("神一般的异常");

    }
}
